<template>
    <div class="playlist">
        <Tapbar></Tapbar>
        <div class="top">
            <div class="top-con">
                <img src="https://cdnmusic.migu.cn/v3/static/img/music/playlist/btn-left-carousel.png" alt="" class="prev" @click="prev()">
                <img src="https://cdnmusic.migu.cn/v3/static/img/music/playlist/btn-right-carousel.png" alt="" class="next" @click="next()">
                <div class="list">
                    <ul ref="name">
                        <li v-for="(item,index) in arr.top" :key="index">
                            <div class="pic">
                                <img :src="item.imgsrc" alt="">
                                <div class="tip">
                                    <div class="tip-top">
                                        <img src="https://cdnmusic.migu.cn/v3/static/img/music/playlist/icon-music.png" alt="">
                                        <span>{{item.count}}W</span>
                                    </div>
                                    <p class="tip-txt">{{item.descript}}</p>
                                </div>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
        <div class="tab">
            <ul>
                <li>小清新</li>
                <li>电视剧</li>
                <li>民谣</li>
                <li>旅行</li>
                <li>思念</li>
                <li>
                    <span>更多</span>
                    <img src="https://cdnmusic.migu.cn/v3/static/img/music/playlist/icon-triggle2@.png" alt="">
                </li>
            </ul>
        </div>
        <div class="title">
            <h4>最新</h4>
        </div>
        <div class="song">
            <ul class="song-list">
                <li v-for="(item,index) in arr.content" :key="index">
                    <div class="song-pic">
                        <img :src="item.imgsrc" alt="">
                        <div class="commend">{{item.count}}w</div>
                    </div>
                    <p class="song-title">{{item.title}}</p>
                </li>
            </ul>
            <div class="block">
                <el-pagination
                layout="prev, pager, next"
                :total="1000">
                </el-pagination>
            </div>
        </div>
    </div>
</template>
<script>
import Tapbar from "../components/Tapbar.vue";
import axios from "axios"
export default ({
    name:"PlayList",
    data(){
        return {
            arr:null
        }
    },
    components:{
        Tapbar
    },
    methods:{
        async fn(){
            let {data} = await axios.get(" http://localhost:3000/playlist");
            this.arr = data
            console.log(this.arr)
        },
        prev(){
            this.$refs.name
        }
    },
    created(){
        this.fn();
    }
})
</script>
<style scoped>
.playlist {
    width: 1440px;
    margin: 0 auto;
}
.top {
    width: 1440px;
    height: 276px;
    padding: 55px 120px;
    box-sizing: border-box;
    background: #f3f3f3;
}
.top-con {
    width: 1200px;
    height: 215px;
    padding: 0 50px;
    box-sizing: border-box;
    position: relative;
}
.prev {
    position: absolute;
    left: 10px;
    top: 70px;
}
.next {
    position: absolute;
    right: 10px;
    top: 70px;
}
.list {
    width: 100%;
    overflow: hidden;
}
.top ul {
    width: 1440px;
    padding: 10px;
    margin: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    
}
.top ul li {
    width: 157px;
    height: 155px;
    background: #fff;
    padding: 0 10px;
    border-radius: 8px;
    box-sizing: border-box;
    position: relative;
}
.pic {
    width: 136px;
    height: 136px;
    position: absolute;
    top: -10px;
    left: 10px;
}
.pic>img {
    width: 136px;
    height: 136px;
    border-radius: 8px;
}
.tip {
    width: 136px;
    height: 136px;
    border-radius: 8px;
    background: rgba(0, 0, 0, .2);
    position: absolute;
    top: 0;
    left: 0;
}
.tip img {
    width: 14px;
    height: 14px;
}
.tip-top {
    width: 100px;
    height: 24px;
    margin: 10px auto;
    padding: 6px;
    background: rgba(0, 0, 0, .7);
    box-sizing: border-box;
    color: #fff;
}
.tip-top span {
    margin-left: 4px;
}
.tip-txt {
    width: 112px;
    color: #fff;
    line-height: 22px;
    margin-left: 10px;
}
.tab {
    width: 1200px;
    margin: 0 auto;
}
.tab ul {
    width: 50%;
    height: 100%;
    padding: 0;
    margin: 32px auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.tab ul li {
    color: #333;
    font-size: 14px;
}
.tab ul li img {
    transform: rotate(90deg);
    margin-left: 4px;
}
.title {
    width: 1200px;
    margin: 0 auto;
}
.title h4 {
    font-size: 32px;
    margin: 0;
}
.song {
    width: 1200px;
    margin: 0 auto;
}
.song-list {
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}
.song-list li {
    width: 200px;
    padding: 0 14px;
    box-sizing: border-box;
}
.song-pic {
    width: 176px;
    height: 176px;
    border-radius: 5px;
    position: relative;
}
.song-pic img {
    width: 176px;
    height: 176px;
    border-radius: 5px;
}
.commend {
    width: 73px;
    height: 25px;
    background: rgba(0, 0, 0, .5);
    color: #fff;
    border-radius: 12px;
    line-height: 25px;
    text-align: center;
    position: absolute;
    top: 10px;
    right: 10px;
}
.song-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.el-pagination {
    margin-left: 350px;
}
</style>